SELECT
schema_name([objects].[schema_id]) + '.' + objects.name AS [Schema.Table],
indexes.name AS [Index],
stats.user_seeks,
stats.user_scans,
stats.user_lookups,
stats.user_updates,
indexes.*
FROM
sys.dm_db_index_usage_stats stats
INNER JOIN sys.objects ON stats.OBJECT_ID = objects.OBJECT_ID
INNER JOIN sys.indexes ON indexes.index_id = stats.index_id AND stats.OBJECT_ID = indexes.OBJECT_ID
WHERE
-- stats.user_lookups = 0
-- AND stats.user_seeks = 0
-- AND stats.user_scans = 0
-- AND
indexes.is_primary_key = 0 -- Excludes primary keys as described above
AND indexes.is_unique = 0 -- Excludes unique constarints are described above
ORDER BY
(stats.user_seeks + stats.user_scans + stats.user_lookups) asc,
stats.user_updates DESC
schema_name([objects].[schema_id]) + '.' + objects.name AS [Schema.Table],
indexes.name AS [Index],
stats.user_seeks,
stats.user_scans,
stats.user_lookups,
stats.user_updates,
indexes.*
FROM
sys.dm_db_index_usage_stats stats
INNER JOIN sys.objects ON stats.OBJECT_ID = objects.OBJECT_ID
INNER JOIN sys.indexes ON indexes.index_id = stats.index_id AND stats.OBJECT_ID = indexes.OBJECT_ID
WHERE
-- stats.user_lookups = 0
-- AND stats.user_seeks = 0
-- AND stats.user_scans = 0
-- AND
indexes.is_primary_key = 0 -- Excludes primary keys as described above
AND indexes.is_unique = 0 -- Excludes unique constarints are described above
ORDER BY
(stats.user_seeks + stats.user_scans + stats.user_lookups) asc,
stats.user_updates DESC